home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / System Data / Notarize-2 / Notarize.text < prev    next >
Encoding:
Text File  |  1994-02-28  |  3.9 KB  |  143 lines  |  [TEXT/MPS ]

  1.  
  2. // ---- End Project Data ----
  3.  
  4.  
  5. // ---- File Notarize.t ----
  6.  
  7. // Before Script for "top"
  8. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  9.  
  10. top :=
  11.    {viewBounds: {left: 1, top: 94, right: 184, bottom: 253},
  12.     _proto: protoFloatNGo,
  13.     debug: "top"
  14.    };
  15.  
  16.  
  17. // Before Script for "Notarize"
  18. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  19.  
  20. Notarize := /* child of top */
  21.    {text: "Notarize",
  22.     buttonClickScript:
  23.       func()
  24.       begin
  25.       
  26.           // setup an empty array for the data items in
  27.           // the note
  28.           local myData:=[];
  29.       
  30.           // get the global bounds of the parent to use in
  31.           // calculating the bounds of the data items in the note
  32.           local baseBounds := base:GlobalBox();
  33.           local tempBounds ;
  34.       
  35.           // keep track of the maximum height of the note
  36.           local maxHeight := 0 ;
  37.       
  38.       
  39.           // now go through each item in the view and convert
  40.           // it into a text (para) item in a note
  41.           foreach thing in base:childviewframes() do
  42.              if thing.text exists then
  43.              begin
  44.                 tempBounds := :RelativeRect(baseBounds, thing:GlobalBox()) ;
  45.                 addArraySlot(myData,({viewStationery: 'para,
  46.           
  47.                       // preserve the relative viewbounds by taking the
  48.                       // top, left of the parent (base) view as 0,0
  49.                       viewBounds: tempBounds,
  50.           
  51.                       // get the text
  52.                       text: thing.text,
  53.           
  54.                       // keep the viewFont so it looks right
  55.                       viewFont: thing.viewFont,
  56.           
  57.                       // copy over any styles or tabs (though none are used)
  58.                       styles: thing.styles,
  59.                       tabs: thing.tabs}));
  60.                 maxHeight := MAX(maxHeight, tempBounds.bottom);
  61.              end ;
  62.       
  63.           // now create the note entry
  64.           local myEntry:={viewStationery: 'paperRoll,
  65.                  height: maxHeight,
  66.                  data: myData,
  67.                  timeStamp:time(),
  68.                  modTime:time()};
  69.       
  70.           // add the item to the notes soup
  71.           GetUnionSoup(ROM_paperrollsoupname):AddToDefaultStore(myEntry);
  72.       
  73.           // tell the notepad to update itself
  74.           BroadcastSoupChange(ROM_paperrollsoupname);
  75.       
  76.       end,
  77.     viewBounds: {left: 83, top: 115, right: 163, bottom: 131},
  78.     viewFont: ROM_fontSystem14Bold,
  79.     RelativeRect:
  80.       // normalize the rectangle of a childview to its parent
  81.       func(parentRect, childRect)
  82.       begin
  83.          local r := {top: childRect.top - parentRect.top,
  84.                      left: childRect.left - parentRect.left} ;
  85.          r.bottom := r.top + (childRect.bottom - childRect.top) ;
  86.          r.right := r.left + (childRect.right - childRect.left) ;
  87.          r ;
  88.       end,
  89.     _proto: protoTextButton,
  90.     debug: "Notarize"
  91.    };
  92.  
  93.  
  94.  
  95.  
  96. // Before Script for "_view000"
  97. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  98.  
  99. _view000 := /* child of top */
  100.    {text: "So, it's some text - what do you think ?",
  101.     viewBounds: {left: 9, top: 9, right: 169, bottom: 49},
  102.     viewJustify: 0,
  103.     _proto: protoStaticText
  104.    };
  105.  
  106.  
  107.  
  108.  
  109. // Before Script for "_view001"
  110. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  111.  
  112. _view001 := /* child of top */
  113.    {
  114.     text:
  115.       "Hello Richard Hello Richard Hello Richard Hello Richard Hello Richard Hello Richard Hello Richard Hello Richard Hello Richard Hello Richard Hello Richard Hello Richard "
  116.     ,
  117.     viewBounds: {left: 9, top: 57, right: 73, bottom: 145},
  118.     viewJustify: 0,
  119.     viewFont: simpleFont9,
  120.     _proto: protoStaticText
  121.    };
  122.  
  123.  
  124.  
  125.  
  126. // Before Script for "_view002"
  127. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  128.  
  129. _view002 := /* child of top */
  130.    {text: "In Box",
  131.     viewBounds: {left: 89, top: 57, right: 145, bottom: 81},
  132.     _proto: protoStaticText
  133.    };
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141. // ---- Beginning of section for non used Layout files ----
  142.  
  143. // End of output